import React, { Component } from 'react'
import TabControl from './components/TabControl'

export class App extends Component {
  constructor() {
    super()

    this.state = {
      title: ['流行', '新款', '精选', '嘿嘿'],
      theIndex: 0
    }
  }
  render() {
    const { title, theIndex } = this.state
    return (
      <div>
        <TabControl
          changeMsg={(index) => {
            this.newMsg(index)
          }}
          title={title}
        />
        <h1>{title[theIndex]}</h1>
      </div>
    )
  }

  newMsg(index) {
    this.setState({
      theIndex: index
    })
  }
}

export default App
